#ifndef __MYSQL_ROW
#define __MYSQL_ROW

#include "StdAfx.h"


namespace Database
{
	namespace _xxImpl_MySql
	{
		class MysqlRow : public IDBRow
		{
			Field* m_pFields;
			uint32 m_numFields;
		public:
			MysqlRow() : m_pFields(0)
			{
			}

			IField& operator[](uint32 index)
			{
				if(index >= m_numFields)
					throw DatabaseException(0xFDD, "IField& operator[](uint32 index)");
				return m_pFields[index];
			}

			void Init(MYSQL_ROW row, uint32 numFields)
			{
				if(!m_pFields)
					m_pFields = new Field[numFields];
				m_numFields = numFields;
				for(uint32 i = 0; i < numFields; ++i)
					m_pFields[i].Init(row[i]);
			}

			void Deinit()
			{
				if(m_pFields)
					delete [] m_pFields;
			}
		};
	}
}
#endif /* __MYSQL_ROW */